<template>

    <div class="top">
      <van-nav-bar

          left-text="返回"
          left-arrow
          @click-left="onClickLeft"
      />
    </div>
    <div class="total">
      <div> 共有记录</div>
      <span> {{ result.length }}条</span>
    </div>

    <div class="body">
      <div class="title">
        积分兑换记录
      </div>
      <div class="item" v-for="i in result">
        <div class="name">{{ i.code }}</div>
        <div class="score">{{ i.time }}</div>
        <div class="time">{{ i.updateTime }}</div>
      </div>
    </div>
</template>

<script setup>
import {useRouter} from "vue-router";
const onClickLeft = () => {
  router.back()
}
import { onMounted, inject, ref} from "vue";

const axios = inject("axios")
const result = ref([])
const router = useRouter();

const qq = ref("")
onMounted(() => {
  qq.value = window.localStorage.getItem("qq")
  axios.get('code/record?qq=' + qq.value).then(res => {
    result.value = res.data?.data
  }).catch(er => {
  })
})
</script>


<style scoped lang="less">
.top {
  width: 100vw;
  margin: 0 auto;
}

.total {
  border: 0 solid black;
  background-color: #F3906B;
  width: 98%;
  height: 100px;
  color: #ffffff;
  font-size: 16px;
  line-height: 30px;
  margin: 20px auto;
  padding-left:20px;
  padding-top:1px;
  box-sizing: border-box;
  border-radius: 10px;

  div {
    margin-top: 20px;
  }

  span {
    font-size: 20px;
    font-weight: 700;
  }
}

.body {
  width: 90%;
  background-color: #ffffff;
  margin: 10px auto;
  text-align: start;
  border-radius: 10px;
  padding: 10px;

  .title {
    height: 50px;
    display: flex;
    align-items: center;
    text-indent: 1em;
    color: black;
    font-size: 16px;
    letter-spacing: 3px;

    border-left: 5px solid #F3906B;
    width: 100%;
    margin-bottom: 20px;
  }

  .item {
    display: flex;
    width: 100%;
    font-size: 14px;
    color: #A8ABB2;
    border-bottom: 1px solid #F2F6FC;
    text-align: start;
    line-height: 25px;

    .time {
      width: 45%;
    }

    .name {
      width: 40%;
    }

    .score {
      width: 15%;
    }

    div {
      word-wrap: break-word;
      word-break: break-all;
      overflow: hidden;
      height: 50px;
      margin:0 3px
    }
  }

}
</style>